/******************************************************************************
*
* This file is part of FreeTrack (http://code.google.com/p/qtfreetrack).
* BY Willy Gardiol (willy@gardiol.org)
*
* FreeTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar.  If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/

#ifndef LAYER_H
#define LAYER_H

#include <QObject>
#include <QPainter>

class FreeTrackWidget;
class LayerLabel;

class Layer : public QObject
{
    Q_OBJECT
public:
    explicit Layer(QString t, QString d );

    // Manage layer title
    QString getTitle();
    void setTitle( QString t );
    // Manage layer description
    QString getDescription();
    void setDescription( QString t );

    // Get some layer specific data
    QString getId();
    bool isModified();

    // Perform layer paint operations
    virtual void paintLayer(QPainter&painter, const QTransform&, const QRectF& clip);
    // Return a widget used to configure the layer. The caller must display the widget.
    virtual FreeTrackWidget* getConfigureLayer();
    // Return a widget used to display the layer in the layer manager
    virtual FreeTrackWidget* getLayerLabel();

public slots:
    // Provide a default way to save layer's data on quit
    virtual void prepareToQuit();

signals:
    // This is emitted when the title changes
    void titleUpdated(QString);
    // This is emitted when the description changes
    void descriptionUpdated(QString);
    // This is emitted when a redraw is needed
    void redraw();

private:
    QString id;

protected:
    QString title;
    QString description;

    bool modified;

};

#endif // LAYER_H

